﻿using System.Web.Mvc;
using CWB.Common.Constant;
using CWB.Common.Logging;
using CWB.Common.Utilities;
using CWB.Web.DB;
using CWB.Web.Models.Configuration;
using CWB.Web.MVC.BaseController;
using CWB.Web.MVC.Filters;
using CWB.WebSite.Models;
using CWB.WebSite.Models.Agent;

namespace CWB.WebSite.Controllers
{
    [PermissionFilterAttvibute(loginType = LoginType.Bo)]
    public class ProductController : MultiCultureBaseController
    {
        private static readonly ISysLog Log = SysLog.GetLogger(typeof(ProductController));

        public ProductController(LanguageInfo languageInfo)
            : base(languageInfo)
        {
            ControllerPermision = Permission.Private;
        }

        //
        // GET: /Product/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Create()
        {
            return View();
        }

        [NoClientCacheFilter]
        public ActionResult Update(int id)
        {
            DbModuleProd dProdItem = new DbModuleProd();
            DbTableProduct odb = new DbTableProduct();
            try
            {
                dProdItem = odb.getProdItemBySn(id);
                ViewData.Model = dProdItem;
            }
            catch
            {
                ViewData["errmsg"] = Localization.TrandlateMessage(Err.ProductIsNotExisting);
            }
            return View();
        }
    }
}
